package com.fs.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fs.mapper.SysAdminRoleMenuMapper;
import com.fs.pojo.SysAdminRoleMenus;
import com.fs.service.SysAdminRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SysAdminRoleMenuServiceImpl implements SysAdminRoleMenuService {
    @Autowired
    private SysAdminRoleMenuMapper sysAdminRoleMenuMapper;

    @Override
    public List<Integer> queryMenuIdList(Long roleId) {
        QueryWrapper<SysAdminRoleMenus> qrw=new QueryWrapper<>();
        qrw.in("role_id",roleId);
        List<SysAdminRoleMenus> sysAdminRoleMenusEntities = sysAdminRoleMenuMapper.selectList(qrw);
        List<Integer> list=new ArrayList<>();
        for (SysAdminRoleMenus entity : sysAdminRoleMenusEntities) {
            list.add(entity.getMenuId());
        }
        return list;
    }
}
